#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3f;

void solve()
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    int ans = 0;
    for (int k = 0; k < 32; k++)
    {
        int a = 0, b = 0, c = 0, d = 0;
        for (int i = 0; i < n; i++)
        {
            int bit = (v[i] >> k) & 1;
            int cnt = __builtin_popcountll(v[i] & ((1 << (k + 1)) - 1));
            if (bit == 0)
            {
                if (cnt % 2 == 0) a++;
                else b++;
            }
            else
            {
                if (cnt % 2 == 0) c++;
                else d++;
            }
        }
        ans += (a * d + c * b) * (1 << k);
    }
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    //cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}